<?php


namespace App\Transformers\Cart;



use App\Models\Cart;
use League\Fractal\TransformerAbstract;

class CartTransformer extends TransformerAbstract
{



    public function transform(Cart $data)
    {
        return [
            'id' => $data->id,
            'user_id' => $data->user_id ?? '',
            'product_id' => $data->product_id ?? '',
            'combination_id' => $data->combination_id ?? '',
            'seckill_id' => $data->seckill_id ?? '',
            'bargain_id' => $data->bargain_id ?? '',
            'product_attr_unique' => $data->product_attr_unique ?? '',
            'product_num' => $data->product_num ?? 0,
            'is_pay' => $data->is_pay ?? 0,
            'is_new' => $data->is_new ?? 0,
            'deleted_at' => $data->deleted_at ? $data->deleted_at->format("Y-m-d H:i:s") : '',
            'created_at' => $data->created_at ? $data->created_at->format("Y-m-d H:i:s") : '',
            'updated_at' => $data->updated_at ? $data->updated_at->format("Y-m-d H:i:s") : '',
        ];
    }


}
